home *** CD-ROM | disk | FTP | other *** search
Text File | 2000-02-22 | 5.0 KB | 177 lines | [TEXT/R*ch] |
- (c) 2000 Peter Li, All Rights Reserved.
- =======================================
-
-
- This module provides some routines that mimic Perl routines.
- They may differ slightly from their Perl implementation, but their general
- functionality should be the same. For more info on Perl go to:
- <http://www.perl.org/> or <http://www.perl.com/>
-
-
- Standard Lib Routines
- =====================
-
- LoadModuleConstants();
-
- Description: Loads constants used by Perl Module to make scripts
- more readable.
- Parameters: none
- Returns: null
-
- -----------------------------
-
- GetModuleVersion();
-
- Description: Returns the version of this module.
- Parameters: none
- Returns: null
-
-
-
- Perl Like Routines
- ==================
-
- chomp(string* ioStr);
-
- Description: chops off all trailing '\r' and '\n'.
- Parameters: address of a string to be chomped.
- Returns: null
-
- Example: string str = "abc\r\n";
- Perl.chomp(&str);
- /* str now = "abc" */
-
- -----------------------------
-
- chop(string* ioStr);
-
- Description: chops off trailing '\r' or '\n'. ie ONLY one.
- Parameters: address of a string to be chomped.
- Returns: null
-
- Example: string str = "abc\n";
- Perl.chop(&str);
- /* str now = "abc" */
-
- -----------------------------
-
- int = hex(string inHexStr);
-
- Description: converts a hex string into a number. eg "0x0A" -> 10
- Parameters: inHexStr - hex number represented as a string.
- Returns: hex number converted to a number.
-
- Example: string str = "0x0A";
- int num = Perl.hex(str);
- /* num = 10 */
-
- -----------------------------
-
- int = index(string inStr, string inSubStr [, int inFromPos]);
-
- Description: Finds the position of a sub-string in another string.
- Looks for inSubStr in inStr optionally starting at inFromPos
- or from start of inStr if inFromPos is not provided.
- Parameters: inStr - string to search for the sub-string.
- inSubStr - sub-string to search for.
- inFromPos - optional field to specify where to start looking
- for the sub-string inside the main string. Defaults
- to zero, ie the start of inStr.
- Returns: returns position of sub-string or -1 if not found.
-
- Example: int pos = Perl.index("abcd", "b");
- /* pos = 1 */
-
- -----------------------------
-
- string = join(string inSep [,string inData]+);
-
- Description: joins the parameters passed in together with a seperator.
- Parameters: inSep - the string to be used as the seperator.
- inData - one of a possible list of strings (or numbers).
- Returns: a string with all the parameters concatenated.
-
- NOTE: numbers represent the ASCII value, they are not converted to
- strings.
-
- Example: string str = Perl.join("::", "a", "b", 10, "c");
- /* str = "a::b::\n::c" */
-
- -----------------------------
-
- lc(string* ioStr);
-
- Description: converts the string passed in to lowercase.
- Parameters: ioStr - pointer to string to convert to lowercase.
- Returns: null
-
- Example: string str = "ABC";
- Perl.lc(&str);
- /* str now = "abc" */
-
- -----------------------------
-
- lcfirst(string* ioStr);
-
- Description: converts the first character of string passed in to lowercase.
- Parameters: ioStr - pointer to string to convert to lowercase.
- Returns: null
-
- Example: string str = "The";
- Perl.lcfirst(&str);
- /* str now = "the" */
-
- -----------------------------
-
- int = oct(string inOctNumStr);
-
- Description: converts an octal number string into a number.
- Parameters: inOctNumStr - octal number as a string.
- Returns: octal number as an integer.
-
- Example: string str = "8";
- int num = Perl.oct(str);
- /* num now = 8 */
-
- -----------------------------
-
- int = rindex(string inStr, string inSubStr [, int inFromPos]);
-
- Description: same as index, but looks in reverse order. ie from back of the
- string to the front of the string.
- Parameters: inStr - string to search for the sub-string.
- inSubStr - sub-string to search for.
- inFromPos - optional field to specify where to start looking
- for the sub-string inside the main string. Defaults
- to zero, ie the start of inStr.
- Returns: returns position of sub-string or -1 if not found.
-
- Example: int pos = Perl.rindex("abca", "a");
- /* pos = 3 */
-
- -----------------------------
-
- uc(string* ioStr);
-
- Description: converts the string passed in to uppercase.
- Parameters: ioStr - pointer to string to convert to uppercase.
- Returns: null
-
- Example: string str = "the";
- Perl.uc(&str);
- /* str now = "THE" */
-
- -----------------------------
-
- ucfirst(string* ioStr);
-
- Description: converts the first character of string passed in to uppercase.
- Parameters: ioStr - pointer to string to convert to uppercase.
- Returns: null
-
- Example: string str = "the";
- Perl.ucfirst(&str);
- /* str now = "The" */
-
- -----------------------------
-